
package au.com.lastweekend.jim.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import au.com.lastweekend.jim.swing.SwingUtil;

/**
 * @author ggardner
 * 
 */
public class AdjustSlideCellSizeAction extends AbstractAction {

    private static final long serialVersionUID = 1L;
    private AdjustSlideCellSizeController controller;
    private int increment;

    public interface AdjustSlideCellSizeController {

        void adjustSlideSize(int adjustment);

    }

    public AdjustSlideCellSizeAction(AdjustSlideCellSizeController controller, int increment) {

        super(increment < 0 ? "Smaller slides" : "Bigger slides");
        this.controller = controller;
        this.increment = increment;
        if (increment < 0) {
            SwingUtil.setActionParameters(this, "arrow_in.png", "Smaller slides", "Decrease slide icon size");
        } else {
            SwingUtil.setActionParameters(this, "arrow_out.png", "Bigger slides", "Increase slide icon size");
        }
        putValue(SwingUtil.MENU, "View");
        putValue(SwingUtil.TOOLBAR, true);
        putValue(SwingUtil.POPUP, true);

    }

    public void actionPerformed(ActionEvent e) {

        controller.adjustSlideSize(increment);
    }
}